<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<html>
<head>
<meta name="decorator" content="front" />
<title>${title }</title>
<link href="${ctxStatic }/xiake/css/list.css" rel='stylesheet' type='text/css' />
<link href="${ctxStatic }/cityselector/cityselect.css" rel='stylesheet'type='text/css' />
<script type="text/javascript" src="${ctxStatic }/cityselector/cityselect.js"></script>
<style>.imglist img{width:20px;height:18px;}</style>
<script>
$(function(){
	// 初始化站点选择框
/* 	var city = $('#departcityid').val();
	$.post('${ctxFront}/info/site/siteAndCityJson',{spottypes:'a',city:city}, function(data) {
		new Vcity.CitySelector({input:'destcity_sitename',cityData:data});
	}); */
	$.post('${ctxFront}/info/site/siteJson',{spottypes:'a'}, function(data) {
		new Vcity.CitySelector({input:'destcity_sitename',cityData:data});
	});
	$.post('${ctxFront}/info/site/siteJson',{spottypes:'8'}, function(data) {
		new Vcity.CitySelector({input:'departcity_sitename',cityData:data});
	});
	$('#daysnum,input[name="cargotype.cargotypeid"],input[name="office.id"]').change(function(){
		$('#searchForm').submit();
	});
/* 	$("#departcityid").on('change',function(e){
		var city = $('#departcityid').val();
		$.post('${ctxFront}/info/site/siteAndCityJson',{spottypes:'a',city:city}, function(data) {
				new Vcity.CitySelector({input:'destcity_sitename',cityData:data});
			});
	});   */
});
$(function() {
	$('.trainRentType').change(function(){
		changeRentType($(this).val());
	});
	changeRentType($('.trainRentType:checked').val());
});

function changeRentType(val){
	if(val=='接火车') {
		var span = $('.trainDestcitySpan');
		$(span[0]).text('火车站');
		$(span[1]).text('抵达地点');
	} 
	if(val=='送火车') {
		var span = $('.trainDestcitySpan');
		$(span[0]).text('火车站');
		$(span[1]).text('出发地点');
	}
}
function detailSearch(type) {
	if(type=='cargotype') {
		$('input[name="cargotype.cargotypeid"]').removeAttr('checked');
	}
	if(type=='office'){
		$('input[name="office.id"]').removeAttr('checked');
	}
	$('#searchForm').submit();
	
}
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
	return false;
}
</script>
</head>
<body>
	<input type="hidden" id="menuInfo" value="indexPickSend">
	<div class="container">
		<div class="container_nav font_normal_size">
			<a href="${ctxFront}/index">霞客约车</a>&gt;<span class="main_color">接送火车</span>
		</div>
		<form id="searchForm" action="${ctxFront }/rentproduct/list" method="get">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<input type="hidden" name="rentType" value="${ORDER_TYPE_RENTPRODUCT_TRAIN }"/>
			<div class="container_type font_normal_size">
				<div>
					<label>接送类型</label>
					<input type="radio" name="tabType" class="trainRentType" value="接火车" ${tRentproduct.tabType == '接火车'?'checked':'' }>&nbsp;接火车&nbsp;&nbsp;
					<input type="radio" name="tabType" class="trainRentType" value="送火车" ${tRentproduct.tabType == '送火车'?'checked':'' }>&nbsp;送火车<br/>
				</div>
				<label class="trainDestcitySpan"></label>
				<input type="text" id="departcity_sitename" class="container_type_a" name="departcity.sitename" value="${tRentproduct.departcity.sitename }" placeholder="请选择火车站" autocomplete="off">
				<input type="hidden" id="departcityid" name="departcity.siteid" value="${tRentproduct.departcity.siteid }">
				<label class="trainDestcitySpan"></label>
				<input type="text" id="destcity_sitename" class="container_type_a" name="destcity.sitename" value="${tRentproduct.destcity.sitename }" placeholder="请选择地点" autocomplete="off">
				<input type="hidden" name="destcity.siteid" value="${tRentproduct.destcity.siteid }">
				<label class="">出发时间</label>
				<input id="fromdateStr" name="fromdateStr" type="text" readonly="readonly" maxlength="20" class="container_type_sn Wdate"
					value="${tRentproduct.fromdateStr }"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'${currDateYmdStr}',isShowClear:false});"/>&nbsp;
				<input id="time" name="time" type="text" readonly="readonly" maxlength="20" class="container_type_ss Wdate" value="${tRentproduct.time }"
					onclick="WdatePicker({dateFmt:'HH:mm',isShowClear:false});"/>
				<div onclick="$('#searchForm').submit();" class="container_type_z pointer">搜索</div>
			</div> 
			<div class="container_cartype font_normal_size">
				<div class="container_cartype_c">
					<label>车型</label>
					<div onclick="detailSearch('cargotype');" class="container_cartype_b pointer">不限</div>
				</div>
				<div class="container_cartype_a">
					<c:forEach items="${cargotypeList }" var="cargotype">
						<span><input type="radio" name="cargotype.cargotypeid" value="${cargotype.cargotypeid }" ${tRentproduct.cargotype.cargotypeid == cargotype.cargotypeid?'checked':'' }>&nbsp;&nbsp;${cargotype.typename }</span>
					</c:forEach>
				</div>
			</div>
			<div class="clear"></div>
			<div class="container_cartype font_normal_size">
				<div class="container_cartype_c">
					<label>服务商</label>
					<div onclick="detailSearch('office');" class="container_cartype_b pointer">不限</div>
				</div>	
				<div class="container_cartype_a">
					<c:forEach items="${officeList }" var="office">
						<span class="container_cartype_span2"><input type="radio" name="office.id" value="${office.id }" ${tRentproduct.office.id == office.id?'checked':'' }>&nbsp;&nbsp;${not empty office.abbr?office.abbr:office.name }</span>
					</c:forEach>
				</div>
			</div>	
		</form>
		<div class="container_table">
			<table id="rentproductTable">
				<tr class="font_large_size">
					<th>车型</th>
					<th>服务商</th>
					<th>可乘人数及行李数</th>
					<th>含</th>
					<th>价格</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${page.list }" var="rentproduct">
					<tr class="font_normal_size">
						<td>
							<div>
								<c:if test="${not empty rentproduct.cargotype.cartypelogo }">
									<c:set var="cargotypeImg" value="${rentproduct.cargotype.cartypelogo }"></c:set>
								</c:if>
								<c:if test="${empty rentproduct.cargotype.cartypelogo }">
									<c:set var="cargotypeImg" value="${ctxStatic }/xiake/images/126 (3).png"></c:set>
								</c:if>
								<img src="${cargotypeImg }" class="list-logo"/>
								<div>${rentproduct.cargotype.typedesc }</div>
								<div>${rentproduct.cargotype.typename }</div>
								<%-- <c:if test="${rentproduct.cargotype.iselectric == '1' }"><div>纯电动车,续航${rentproduct.cargotype.continuerange }公里</div></c:if> --%>
							</div>
						</td>
						<td>
							<div>
								<c:if test="${not empty rentproduct.office.companylogo  }">
									<c:set var="officeImg" value="${rentproduct.office.companylogo }"></c:set>
									<img src="${officeImg }" class="list-logo"/>
								</c:if>
<%-- 								<c:if test="${empty rentproduct.office.companylogo }">
									<c:set var="officeImg" value="${ctxStatic }/xiake/images/126 (2).png"></c:set>
								</c:if> --%>
								
								<div>${not empty rentproduct.office.abbr?rentproduct.office.abbr:rentproduct.office.name }</div>
								<!--特色服务 -->
								<div class="imglist">
									<c:if test="${rentproduct.office.iswifi == '1' }"><img src="${ctxStatic }/xiake/images/WIFI.png"/></c:if>
									<c:if test="${rentproduct.office.powersupply == '1' }"><img src="${ctxStatic }/xiake/images/C.png"/></c:if>
									<c:if test="${rentproduct.office.tablewater == '1' }"><img src="${ctxStatic }/xiake/images/S.png"/></c:if>
									<c:if test="${rentproduct.office.businesssuit == '1' }"><img src="${ctxStatic }/xiake/images/SW.png"/></c:if>
									<c:if test="${rentproduct.office.paper == '1' }"><img src="${ctxStatic }/xiake/images/Z.png"/></c:if>
								</div>
								<!--特色服务 -->
							</div>
						</td>
						
						<td>
							<div class="display_ib table_shu">
								<img src="${ctxStatic }/xiake/images/126 (4).png"/>
								<div>${rentproduct.seats }</div>
							</div>
							<div class="display_ib table_shu">
								<img src="${ctxStatic }/xiake/images/126 (1).png"/>
								<div>${rentproduct.packs }</div>
							</div>
						</td>
						<td>
							<span>一口价</span>
						</td>
						<td><div class="showsuitrtnprice">￥<fmt:formatNumber type="number" value="${rentproduct.suitrtnprice }" pattern="0.00" maxFractionDigits="2"/></div></td>
						<td>
							<div class="container_table_y pointer">
								<a class="color_white" href="javascript:window.location.href='${ctxFront }/rentproduct/details?time='+$('#time').val()+'&daysnum=${tRentproduct.daysnum }&rentid=${rentproduct.rentid}&rentType=${tRentproduct.rentType}&tabType=${tRentproduct.tabType}&fromdateStr='+$('#fromdateStr').val();">预定</a>
							</div>
						</td>		
					</tr>
				</c:forEach>
			</table>
			<c:if test="${empty page.list }">
				<div style="text-align: center;margin:20px;font-size:14px;color:#607D8B;">霞客君太懒，您要的产品还没有上架。您可以试试<a href="${ctxFront }/rentproduct/demands/form" style="color:#4FBDBA;">定制包车</a>哦~</div>
			</c:if>
			<div style="text-align: center;">
				<div class="pagination  font_normal_size" >${page.html}</div>
			</div>
			<div class="clear"></div>
		</div>
	</div>
</body>
</html>